package com.baizhi.cmfzdemo.controller;

import com.baizhi.cmfzdemo.entity.CmfzAlbum;
import com.baizhi.cmfzdemo.service.CmfzAlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by 54433 on 2019/4/4.
 */
@Controller
@RequestMapping("/cmfzAlbum")
public class CmfzAlbumController {
    @Autowired
    private CmfzAlbumService cmfzAlbumService;

    //展示所有
    @RequestMapping("/queryAllCmfzAlbum")
    @ResponseBody
    public Map queryAllCmfzAlbum(int page,int rows){
        System.out.println("222222222222");
        System.out.println(cmfzAlbumService.queryAllCmfzAlbum(page,rows));
        System.out.println("***&&*&*&*&(&(*^*(^(*^*&*(");
        return cmfzAlbumService.queryAllCmfzAlbum(page,rows);
    }
    @RequestMapping("/deleteCmfzAlbum")
    @ResponseBody
    public Map deleteCmfzAlbum(int [] ids){
        return cmfzAlbumService.deleteCmfzAlbum(ids);
    }
    @RequestMapping("/insertCmfzAlbum")
    @ResponseBody
    public Map insertCmfzAlbum(CmfzAlbum cmfzAlbum){
        return cmfzAlbumService.addCmfzAlbum(cmfzAlbum);
    }
    @RequestMapping("/updateCmfzAlbum")
    @ResponseBody
    public Map updateCmfzAlbum(CmfzAlbum cmfzAlbum){
        return cmfzAlbumService.updateCmfzAlbum(cmfzAlbum);
    }

    @RequestMapping("/queryAllAlbumTree")
    @ResponseBody
    public List<CmfzAlbum> queryAllAlbumTree(){
        System.out.println(cmfzAlbumService.queryAllCmfzAlbumTree());
        return cmfzAlbumService.queryAllCmfzAlbumTree();
    }
}
